/**
 * 
 * axios post请求默认提交的是JSON,如果需要提交 application/x-www-form-urlencoded =>
 * 1、引入 import queryString from 'querystring';
 * 2、参数 queryString.stringify(para)
 * [参考](https://github.com/mzabriskie/axios#using-applicationx-www-form-urlencoded-format)
 * 
 * 
 * [API地址](http://59.107.26.181:8088/swagger-ui.html#!/private-product-controller/addUsingPOST)
 */

import axios from 'axios';
import queryString from 'querystring';

let api = {
    getPPList: '/api-product/v1/privateProduct/web/list', //列表 
    getPPDetail: '/api-product/v1/privateProduct/detail', //详情 
    postAddPrivateProduct: '/api-product/v1/privateProduct/add', //创建私募产品 
    postPPBaseInfo: '/api-product/v1/privateProduct/update/base', //修改基本信息 
    postUpdateRichTextCont: '/api-product/v1/privateProduct/update/extra', //修改私募产品富文本信息 
    postPPStatus: '/api-product/v1/privateProduct/update/status', //修改产品状态
    postPPCopy: '/api-product/v1/privateProduct/oneKeyCopy', //一键复制
}

const postAddPrivateProduct = (param) => {
    return axios.post(api.postAddPrivateProduct, param)
}

const postPPStatus = (param) => {
    return axios.post(api.postPPStatus, param)
}

const postPPCopy = (param) => {
    return axios.post(api.postPPCopy, queryString.stringify(param))
}

const postPPBaseInfo = (param) => {
    console.log(param)
    return axios.post(api.postPPBaseInfo, param)
}

const postUpdateRichTextCont = (param) => {
    console.log(param)
    return axios.post(api.postUpdateRichTextCont, param)
}

const getPPList = (params) => { return axios.get(api.getPPList, { params: params }) }

const getPPDetail = (params) => { return axios.get(api.getPPDetail, { params: params }) }


export {
    api,
    postAddPrivateProduct,
    postPPBaseInfo,
    postUpdateRichTextCont,
    getPPList,
    getPPDetail,
    postPPStatus,
    postPPCopy,

}